package tool

import (
	"gitee.com/yms-zero/go-library/ivalidator"
	ut "github.com/go-playground/universal-translator"
	"sync"
)

var (
	once     sync.Once
	apiTrans ut.Translator
)

func Trans() ut.Translator {
	once.Do(func() {
		t, e := ivalidator.Translations("zh")
		if e != nil {
			panic(e)
		}

		apiTrans = t
	})

	return apiTrans
}
